package com.example.demo.vo

import com.example.demo.dbmodels.TDevice
import io.swagger.annotations.ApiModel
import io.swagger.annotations.ApiModelProperty
import org.apache.commons.beanutils.BeanUtils
import java.time.LocalDateTime


@ApiModel(description = "设备信息")
class DeviceVo {

    var id: Int? = null
    /**
     *  科室编号
     **/
    var dept_code: String? = null
    /**
     *  设备号
     **/
    var device_no: String? = null
    /**
     *  设备mac地址
     **/
    var device_mac: String? = null
    /**
     *  设备ip地址
     **/
    var device_ip: String? = null
    /**
     *  设备类型 0:床头卡 1:护理看板 2:移动PDA
     **/
    var device_type: Int?= null
    /**
     *  绑定的床ID
     **/
    var register_bed: String? = null
    /**
     *  绑定的状态 0:未绑定 1:绑定中
     **/
    var register_state: Int?= null
    /**
     *  设备当前app版本号
     **/
    var app_version: String?= null
    /**
     *  护理看板ip地址
     **/
    var nurseboard_ip: String? = null
    /**
     *  最后更新时间
     **/
    var last_up_time: LocalDateTime?= null
    /**
     *  最新APP版本号
     **/
    var last_app_version: String? = null
    /**
     *  更新时间
     **/
    var update_time: LocalDateTime?= null
    /**
     *  更新人
     **/
    var update_by: Int?= null
    /**
     *  删除标记
     **/
    var is_del: Boolean?= null

    fun getVo(table: TDevice): DeviceVo {
        table.let {
            val data = DeviceVo()
            data.id = it.id
            data.dept_code = it.dept_code
           data.app_version = it.app_version
            data.device_ip = it.device_ip
            data.device_mac = it.device_mac
            data.device_no = it.device_no
            data.device_type = it.device_type
            data.is_del= it.is_del
            data.last_app_version = it.last_app_version
            data.last_up_time = it.last_up_time
            data.nurseboard_ip = it.nurseboard_ip
            data.register_bed = it.register_bed
            data.register_state = it.register_state
            data.update_by = it.update_by
            data.update_time = it.update_time
            return data
        }
    }

    fun getListVo(table: List<TDevice>): List<DeviceVo> {
        table.let {
            val listData = mutableListOf<DeviceVo>()
            it.forEach {
                val data = DeviceVo()
                data.id = it.id
                data.dept_code = it.dept_code
                data.app_version = it.app_version
                data.device_ip = it.device_ip
                data.device_mac = it.device_mac
                data.device_no = it.device_no
                data.device_type = it.device_type
                data.is_del= it.is_del
                data.last_app_version = it.last_app_version
                data.last_up_time = it.last_up_time
                data.nurseboard_ip = it.nurseboard_ip
                data.register_bed = it.register_bed
                data.register_state = it.register_state
                data.update_by = it.update_by
                data.update_time = it.update_time
                listData.add(data)
            }
            return listData
        }
    }


}
